/*
Русское описание вы найдёте чуть ниже.
Русским: Не ржать над моим английским.
First of all, sorry for my English. I know, it worst.
So..
Server AimBot (suddenly...)
Thanks to DJ_WEST for:http://amx-x.ru/viewtopic.php?p=693#p693
			Ser_UFL for:http://amx-x.ru/viewtopic.php?p=78649#p78649
			and  Bos93 for:http://amx-x.ru/viewtopic.php?p=78402#p78402
So, first of all commands:
Player_console:
	ADMIN_BAN required:
		aim -0|1 - turns off|on plugin. If it's off no functions will work.
		aim_autoshoot <#id|name|@|@CT|@T> 0|1 - turns off|on automatic shoot on selected player, when he aimed at the enemy
		aim_autoaim	 <#id|name|@|@CT|@T> 0|1 - turns off|on automatic aim on selected player. It will not force player to shoot.
		aim_aimbot	<#id|name|@|@CT|@T> 0|1 - turns off|on aimbot on selected player. It will force player to aim and shoot automatically.
		Aim_Debug  0|1|2|3|4 -Debug mode switch. Highter value means highter debug level. It will save to logs/server_aimbot 
		Aim_Who - show who uses autoaim or autoshoot.
	No admin rules required:
		+aimbot - If CVAR:aim_button_mode ==1, player should use this command to make chear work.

Server console:
		aim_make_config - Recreate ServerAimBot config file. On first start it will be executed automatically
		aim_make_lang -  Recreate ServerAimBot lang file. On first start it will be executed automatically	
Did anybody surprised? Huh...

aim_always_on 0/1 ServerAimBot is always off|on:Default 0.
aim_button_mode 0/1 Player must_not|must hold +aimbot. Default 1.
aim_attackmode 0/1 How should player shoot. 1-HamExecute. 0-+attack;wait;-attack. Default 1;
aim_frame_delay 5 .If aim_attackmode==1 player will shoot every frame~>60 FPS. This value shows, how many frames shold player skip before next HamExecute. Default 0.
aim_autoaim_always_on 0/1 Player will_not|will have automatic aim when connected. Default:0
aim_autoshoot_always_on 0/1 Player will_not|will have automatic shoot when connected. Default:0
aim_show_admin 0|1|2. Show admin operations with ServerAimBot to players. 0=Don't show|1=Show anonymously| 2= Show named
aim_correction - Autoaim correction by Z axis (up-down). Default 0.
aim_no_damage 0|1 - Player will_not|will be able to kill someone with automatic shoot. Default: 1
aim_endless_ammo 0|1 - The player will have endless ammo as long as he shoots with automatic shoot.
aim_AlliedModders_rules 0|1 (View Changelog 0.6.5)
Changelog:
0.6.7: (I'm too lazy to translate it... do it yourself. xD)
Немного переписана функция автоматической стрельбы. Теперь вариант через +attack работает эффективнее
+Добавлен квар aim_shoot_divide, определяющий, насколько быстрее будет стрелять человек через +attack.
0.6.6:
An error in infinity ammo function was found. So repared.
0.6.5:
Added: CVAR aim_AlliedModders_rules.
		AlliedModders rules says:"Use log_amx instead of log_to_file". 
		So if this cvar is 1, we'll write log messages to amx log, and if 0, we'll use manually created file for logging. (amxmodx/logs/server_aimbot/Log_....log)
		Default 1

Corrected: OOPS. I didn't notised that we need to check command access manually. So it's corrected.


0.6:
Added:
	Now all admin operations are logged to logs/server_aim/LOG_.......log file.

0.5:
Added:
1. CVAR: aim_no_damage 0|1
2. CVAR:aim_endless_ammo 0|1

Changed:
1. Now it can kill bots and either HLTV, if admin join it to team.

0.0.2 RC: Not interesting. I'm too lazy to translate it from russian.
/////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////
Серверный аимбот. (Внезапно, ога).
Спасибо DJ_WEST за урок по работе с битами http://amx-x.ru/viewtopic.php?p=693#p693
	и за перевод функции проверки на видимость. Ser_UFL за то, что помог её найти. http://amx-x.ru/viewtopic.php?p=78649#p78649
Bos93, за функцию выстрела через ExecuteHam http://amx-x.ru/viewtopic.php?p=78402#p78402
Да и всем остальным. ))


Для начала комманды:
aim -0|1 - включает/выключает функционирование плагина.
aim_autoshoot <#id|name|@|@CT|@T> 0|1 - включает/выключает автоматический выстрел при наведении на врага у выбранного пользователя.
aim_autoaim	 <#id|name|@|@CT|@T> 0|1 - включает/выключает автоматическое наведение на врага у выбранного пользователя.
aim_aimbot	<#id|name|@|@CT|@T> 0|1 - включает/выключает автоматическое наведение на врага и выстрел по нему у выбранного пользователя.
Aim_Debug  0|1|2|3|4 -включает/выключает режим отладки плагина. Инфа пишется в лог. Вы его найдёте в новой папке, которая создастся в папке с логами AMXX. 
Aim_Who - по идее должна показывать, у кого включено автонаведение и/или автоматически выстрел, но почему-то не работает.
+aimbot - Если aim_button_mode ==1, то эту комманду должен использовать игрок для того, чтобы у него работали вышеназванные функции.

aim_make_config - Серверная комманда. Если вы потеряли конфиг или хотите вернуть его к стандартным параметрам, то эта комманда вам поможет. Хотя, в случае отсутствия конфига он должен сгенерироваться сам.
aim_make_lang - Серверная комманда. Если вы потеряли языковой или хотите вернуть его к стандартным параметрам, то эта комманда вам поможет. Хотя, в случае отсутствия языкового файла он должен сгенерироваться сам.
2 последние строчки никого не удивили? Ну и ладно.

aim_always_on 0/1 Аимбот на сервере нормально выключен/включён. Стандартно- выключен.
aim_button_mode 0/1 Пользователь не_должен/должен держать +aimbot. Стандартно- должен.
aim_attackmode 0/1 режим стрельбы. 0-Через HamExecute. 1- Через +attack;wait;-attack. Стандартно через Ham
aim_frame_delay 0...сколько угодно. По сути, функция выстрела через HamExecute запускается каждый клиентский кадр.
Если вас не удивит AWP разрядившаяся меньше чем за секунду, то поставте 0. Стандартная задержка- 5 кадров.
aim_autoaim_always_on 0/1 0:Админ должен включить автонаведение у игрока. 1:Автонаведение включится при заходе игрока. Стандартно 0
aim_autoshoot_always_on 0/1 0:Админ должен включить автоматический выстрел игроком по врагу. 1:Сия возможность включится при заходе игрока. Стандартно 0
aim_show_admin 0/1/2 0:Не палить админа. 1:Палить анонимно. 2:Палить с указанием имени.
aim_correction - корректировка прицела по оси вверх-вниз. Стандартно 0.
aim_no_damage 0|1 - Игрок не_сможет/сможет убить кого-либо читом. Стандартно 1. (Читом можно убить)
aim_endless_ammo 0|1 - Пока игрок стреляет не по своей воле его патроны будут(0)/не_будут(1) заканчиваться.
aim_AlliedModders_rules 0|1 (смотри список изменений 0.6.5)
Напоминаю, что при первом запуске плагина языковой файл и конфиг генерятся сами.

Список изменений:
0.6.7:
Немного переписана функция автоматической стрельбы. Теперь вариант через +attack работает эффективнее
+Добавлен квар aim_shoot_divide, определяющий, насколько быстрее будет стрелять человек через +attack.
0.6.6 : 
В коде за бесконечный боезапас была обнаружена ошибка. Исправлено.//чё за бред? 

Версия 0.6.5:
Добавлено: CVAR aim_AlliedModders_rules.
	В правилах AlliedModders сказано:"Используйте log_amx а не log_to_file".
	Если этот квар 1, то мы будем писать лог в стандартный лог amxx.
	Если 0, то для лога мы будем использовать файл в amxmodx/logs/server_aimbot/Log_....log file
	
Исправлено: Я сразу не заметил, что доступ к комманде надо проверять вручную. В общем, исправлено.


Версия 0.6:
Добавлено.
Теперь все действия админа пишутся в logs/server_aim/LOG_.......log file.

Версия 0.5
Добавлено:
1. Возможность выдать "жертвам этого чита" холостые патроны. CVAR: aim_no_damage 0|1
2. Выключатель для бесконечных патронов.CVAR:aim_endless_ammo 0|1
Рекомендуется пересоздать конфиг (aim_make_config в серверной консоли).

Улучшено:
1. Теперь аимбот адекватно реагирует на хлтв, случайно перенесенного за какую-либо комманду. То бишь убивает его, а не пытается прицелиться в {0,0,0}

////////////////////////////
0.0.2.RC Да, по прежднему релиз-кандидат.
Добавлено:
1. Улучшен алгоритм поиска цели для прицеливания.
2. Теперь в режиме автострельбы патроны бесконечны.
3. В режиме автострельбы убрана отдача.

Исправлено:
Работает список тех, у кого включен AutoAim и AutoShoot, но по прежднему как-то криво.
Исправлены досадные ошибки при массовой выдаче функций.
Исправлен словарь (Рекомендуется перегенерировать)

Ожидается в следующих версиях:
1. Выключатель для бесконечных патронов.
2. Исправление досадных глюков.
/////////////////////////////////////////////////////////////////////////////


*/ 

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <xs>
#include <cstrike>


#define PLUGIN "ServerAimBot"
#define VERSION "0.6.7"
#define AUTHOR "Chuvi"

#define SIZE_OF_NAME 35
#define ADMIN_REQUIRED ADMIN_LEVEL_D
#define GET_FULL_TIME get_time("%y_%m_%d__%H_%M_%S", Current_Time, sizeof(Current_Time))
#define GET_SMALL_TIME get_time("%H_%M_%S", Current_Time, sizeof(Current_Time))
#define EXTRAOFFSET_WEAPONS 4
#define m_flNextPrimaryAttack   46
#define m_flNextSecondaryAttack 47
#define set_shooting(%1) 	Bitsum_Is_Shooting |= (1<<(%1-1))
#define is_shooting(%1) 	(Bitsum_Is_Shooting & (1 << (%1-1)))// ? 1 : 0 
#define stop_shooting(%1)	Bitsum_Is_Shooting &=  ~(1<<(%1-1)) 

#define set_auto_shoot(%1) 	Bitsum_Use_Auto_Shoot |= (1<<(%1-1)) 
#define set_auto_aim(%1)	Bitsum_Use_Auto_Aim |= (1<<(%1-1)) 
#define has_auto_shoot(%1) 	(Bitsum_Use_Auto_Shoot & (1 << (%1-1)))// ? 1 : 0 
#define has_auto_aim(%1)	(Bitsum_Use_Auto_Aim & (1 << (%1-1))) ? 1 : 0 
#define rem_auto_shoot(%1)	Bitsum_Use_Auto_Shoot &=  ~(1<<(%1-1)) 
#define rem_auto_aim(%1)	Bitsum_Use_Auto_Aim &=  ~(1<<(%1-1)) 
#define set_user_auto_shoot(%1) 	Bitsum_User_Auto_Shoot |= (1<<(%1-1)) 
#define set_user_auto_aim(%1)	Bitsum_User_Auto_Aim |= (1<<(%1-1)) 
#define has_user_auto_shoot(%1) 	(Bitsum_User_Auto_Shoot & (1 << (%1-1)))// ? 1 : 0 
#define has_user_auto_aim(%1)	(Bitsum_User_Auto_Aim & (1 << (%1-1)))// ? 1 : 0 
#define rem_user_auto_shoot(%1)	Bitsum_User_Auto_Shoot &=  ~(1<<(%1-1)) 
#define rem_user_auto_aim(%1)	Bitsum_User_Auto_Aim &=  ~(1<<(%1-1)) 

//<stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
			#define GENERAL_X_Y_SORROUNDING             18.5         // 16.0 
			#define CONSTANT_Z_CROUCH_UP                 31.25         // 32.0 
			#define CONSTANT_Z_CROUCH_DOWN                 17.5         // 16.0 
			#define CONSTANT_Z_STANDUP_UP                 34.0         // 36.0 
			#define CONSTANT_Z_STANDUP_DOWN             35.25         // 36.0 
			#define GENERAL_X_Y_SORROUNDING_HALF        9.25         // 8.0 
			#define GENERAL_X_Y_SORROUNDING_HALF2        12.0         // 8.0 
			#define CONSTANT_Z_CROUCH_UP_HALF             15.5         // 16.0 
			#define CONSTANT_Z_CROUCH_DOWN_HALF            8.75         // 8.0 
			#define CONSTANT_Z_STANDUP_UP_HALF            17.0         // 18.0 
			#define CONSTANT_Z_STANDUP_DOWN_HALF        17.5         // 18.0 
			#define ANGLE_COS_HEIGHT_CHECK                0.7071        // cos(45  градусов)   
			#define add_transparent_ent(%1)         bs_array_transp[((%1 - 1) / 32)] |= (1<<((%1 - 1) % 32)) 
			#define del_transparent_ent(%1)         bs_array_transp[((%1 - 1) / 32)] &= ~(1<<((%1 - 1) % 32)) 
			#define  is_transparent_ent(%1)        (bs_array_transp[((%1 - 1) / 32)] & (1<<((%1 - 1) % 32))) 
			#define add_solid_ent(%1)               bs_array_solid[((%1 - 1) / 32)] |= (1<<((%1 - 1) % 32)) 
			#define del_solid_ent(%1)               bs_array_solid[((%1 - 1) / 32)] &= ~(1<<((%1 - 1) % 32)) 
			#define  is_solid_ent(%1)              (bs_array_solid[((%1 - 1) / 32)] & (1<<((%1 - 1) % 32))) 
 
			// Используется для определения головной точки оружия
			new const Float:weapon_edge_point[CSW_P90+1] = 
			{ 
				0.00, 35.5, 0.00, 42.0, 0.00, 35.5, 0.00, 37.0, 37.0, 0.00, 35.5, 35.5, 32.0, 41.0, 32.0, 36.0, 41.0, 35.5, 41.0, 32.0, 37.0, 35.5, 42.0, 41.0, 44.0, 0.00, 35.5, 37.0, 32.0, 0.00, 32.0 
			} ;

			// Используется в качестве массива для умножения
			new const Float:vec_multi_lateral[] =  
			{ 
				GENERAL_X_Y_SORROUNDING, 
				-GENERAL_X_Y_SORROUNDING, 
				GENERAL_X_Y_SORROUNDING_HALF2, 
				-GENERAL_X_Y_SORROUNDING_HALF 
			} ;

			// Используется в качестве высоты, если игрок приседает
			new const Float:vec_add_height_crouch[] = 
			{ 
				CONSTANT_Z_CROUCH_UP, 
				-CONSTANT_Z_CROUCH_DOWN, 
				CONSTANT_Z_CROUCH_UP_HALF, 
				-CONSTANT_Z_CROUCH_DOWN_HALF 
			} ;

			// Используется в качестве высоты, если игрок встает
			new const Float:vec_add_height_standup[] = 
			{ 
				CONSTANT_Z_STANDUP_UP, 
				-CONSTANT_Z_STANDUP_DOWN, 
				CONSTANT_Z_STANDUP_UP_HALF, 
				-CONSTANT_Z_STANDUP_DOWN_HALF 
			};
			new thdl ;
			// Данная бит-сумма позволяет хранить до 2048 объектов.
			new bs_array_transp[64];                // Бит-сумма, которая равняется 64*32
			new bs_array_solid[64];                 // Бит-сумма, которая равняется 64*32
 //</stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >

new Current_Time[32]
new p_Debug_Dir[60]
new p_Debug_File[60]
new Debug_File
new p_Log_File[60]

new p_Config_Dir[60]
new p_Config_File[60]

new p_Lang_Dir[60]
new p_Lang_File[60]

new c_Attack_Mode
new c_Frame_Delay
new c_Aim_Always_On
new c_AutoShoot_Always_On
new c_Show_Admin
new c_Button_Mode
new c_Correction
new c_NoDamage
new c_Inf_Ammo
new c_fast_shoot
new c_AlliedModders_rules
new Bitsum_Use_Auto_Aim
new Bitsum_Use_Auto_Shoot
new Bitsum_User_Auto_Aim
new Bitsum_User_Auto_Shoot
new Bitsum_Is_Shooting

new Aim_Debug=0
new Float:target_vector[33][33][3]
//new Float: target_dist_xy[33][33]
//new const  Float: target_dist[33][33]
new target_diff[33][33][3]
new name[33][35]
new  player_head[33][3]
new Targets_Can_Be_Shooted[33][33]
new Targets_Can_Be_Shooted_Counter[33]
new forwardID
new frame_counter[33]
const m_pActiveItem = 373;
new iWeaponEnt[33]
const m_flNextAttack = 83
new Float:NextPrimAttack
public plugin_precache()
{
	get_localinfo("amx_configdir", p_Config_Dir, sizeof(p_Config_Dir))
	format(p_Config_File, sizeof(p_Config_File), "%s/ServerAimBot.cfg", p_Config_Dir)
	if(!file_exists(p_Config_File))
	{
		server_print("%s created",p_Config_File)
		Create_Config()
	} 
	else
		server_cmd("exec %s", p_Config_File)
	
	get_localinfo("amxx_datadir", p_Lang_Dir, sizeof(p_Lang_Dir))
	format(p_Lang_Dir, sizeof(p_Lang_Dir), "%s/lang", p_Lang_Dir)
	format(p_Lang_File, sizeof(p_Lang_File), "%s/ServerAimBot.txt", p_Lang_Dir)
	if(!file_exists(p_Lang_File))
	{
		server_print("%s created",p_Lang_File)
		Create_Lang()
	} 	
	
	//<stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
	register_forward(FM_Spawn, "fw_spawn", 1) 
	//</stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
}
public plugin_init() 
{	register_dictionary("ServerAimBot.txt")
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("aim", "ServerAim_Switch", ADMIN_REQUIRED,"Turns on|off autoaim system on server")
	register_clcmd("aim_autoshoot","AutoShoot_Function_Switch",ADMIN_REQUIRED,"Turns on|off autoshoot on player")
	register_clcmd("aim_autoaim","AutoAim_Function_Switch",ADMIN_REQUIRED,"Turns on|off autoaim on player")
	register_clcmd("aim_aimbot","AimBot_Function_Switch",ADMIN_REQUIRED,"Turns on|off aimbot on player")
	register_clcmd("Aim_Debug","Aim_Debug_Switch",ADMIN_REQUIRED,"Turns on|off autoaim debug mode")
	register_clcmd("Aim_Who","Who_Use_It",ADMIN_REQUIRED,"Show who uses autoaim")
	register_clcmd("+aimbot","Set_User_Aimbot_On")
	register_clcmd("-aimbot","Set_User_Aimbot_Off")
	register_srvcmd("aim_make_config","Create_Config")
	register_srvcmd("aim_make_lang","Create_Lang")
	register_cvar("aim_always_on","0")
	register_event("CurWeapon", "CurWeapon", "be", "1=1")
	register_event("HLTV", "round_start", "a", "1=0", "2=0")
	c_Button_Mode=register_cvar("aim_button_mode","1")
	c_Attack_Mode=register_cvar("aim_attackmode","2")
	c_Frame_Delay=register_cvar("aim_frame_delay","20")
	c_Aim_Always_On=register_cvar("aim_autoaim_always_on","0")
	c_AutoShoot_Always_On=register_cvar("aim_autoshoot_always_on","0")
	c_Show_Admin=register_cvar("aim_show_admin","0")
	c_Correction=register_cvar("aim_correction","0")
	c_NoDamage=register_cvar("aim_no_damage","0")
	c_Inf_Ammo=register_cvar("aim_endless_ammo","1")
	c_fast_shoot=register_cvar("aim_shoot_divide","1")
	c_AlliedModders_rules=register_cvar("aim_AlliedModders_rules","1")
	GET_FULL_TIME
	get_localinfo("amxx_logs", p_Debug_Dir, sizeof(p_Debug_Dir))
	format(p_Debug_Dir, sizeof(p_Debug_Dir), "%s/server_aimbot", p_Debug_Dir)
	if(!dir_exists(p_Debug_Dir))
	{
		mkdir(p_Debug_Dir)
	}
	format(p_Log_File,sizeof(p_Log_File),"%s/Log_%s.log",p_Debug_Dir,Current_Time)
	if(get_cvar_num("aim_always_on")==1)
	{
		forwardID=register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0)
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot]ServerAimBot turned on by default")
		else
			log_to_file(p_Log_File,"ServerAimBot turned on by default")
	}
	
	//<stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
	thdl = create_tr2() 
	//</stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >


}
public round_start()
{
	for(new i=1;i<=get_maxplayers();i++)
	{
		if(is_user_alive(i)&&is_shooting(i))
		{
			client_cmd(i,"-attack")
			stop_shooting(i)
		}
	}
}

public CurWeapon(id)
{
	if(!is_user_connected(id)||!is_user_alive(id)||!is_shooting(id)||get_pcvar_num(c_Attack_Mode)>0)
		return PLUGIN_CONTINUE
	
	iWeaponEnt[id] = get_pdata_cbase( id , m_pActiveItem , 5 );
	if(!is_valid_ent(iWeaponEnt[id]))
		return PLUGIN_CONTINUE
		
	if(get_pcvar_num(c_Inf_Ammo)==1&&is_valid_ent(iWeaponEnt[id]))
	{
		if(cs_get_weapon_ammo (iWeaponEnt[id])<2)
		cs_set_weapon_ammo(iWeaponEnt[id],7)
	}
	
	

	NextPrimAttack=floatdiv(get_pdata_float(iWeaponEnt[id], m_flNextPrimaryAttack, EXTRAOFFSET_WEAPONS ),get_pcvar_float(c_fast_shoot))
	if(floatcmp(NextPrimAttack,0.0)==1&&floatcmp(0.028,NextPrimAttack)==1)
		NextPrimAttack=0.028
	set_pdata_float(iWeaponEnt[id], m_flNextPrimaryAttack,NextPrimAttack, EXTRAOFFSET_WEAPONS )
	return PLUGIN_CONTINUE	
}

public Set_User_Aim_On(id)
{
	set_user_auto_aim(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s start using autoaim.Bitsum_User_Auto_Aim=%i^n",name[id],Bitsum_User_Auto_Aim)
	return PLUGIN_HANDLED
}
public Set_User_Aim_Off(id)
{
	rem_user_auto_aim(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s stopped using autoaim.Bitsum_User_Auto_Aim=%i^n",name[id],Bitsum_User_Auto_Aim)
	return PLUGIN_HANDLED
}
public Set_User_Aimbot_On(id)
{
	set_user_auto_aim(id)
	set_user_auto_shoot(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s start using aimbot.Bitsum_User_Auto_Aim=%i. Bitsum_User_Auto_Shoot=%i^n",name[id],Bitsum_User_Auto_Aim,Bitsum_User_Auto_Shoot)
	return PLUGIN_HANDLED
}

public Set_User_Aimbot_Off(id)
{
	rem_user_auto_aim(id)
	rem_user_auto_shoot(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s stopped using aimbot.Bitsum_User_Auto_Aim=%i. Bitsum_User_Auto_Shoot=%i^n",name[id],Bitsum_User_Auto_Aim,Bitsum_User_Auto_Shoot)
	return PLUGIN_HANDLED
}

public Set_User_AutoShoot_On(id)
{
	set_user_auto_shoot(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s start using autoshoot. Bitsum_User_Auto_Shoot=%i.^n",name[id],Bitsum_User_Auto_Shoot)
	return PLUGIN_HANDLED
}
public Set_User_AutoShoot_Off(id)
{
	rem_user_auto_shoot(id)
	if(Aim_Debug>2)
		fprintf(Debug_File,"%s stopped using autoshoot. Bitsum_User_Auto_Shoot=%i.^n",name[id],Bitsum_User_Auto_Shoot)
	return PLUGIN_HANDLED
}

public client_disconnect(id)
{	
	rem_user_auto_aim(id)
	rem_user_auto_shoot(id)
	rem_auto_shoot(id)
	rem_auto_aim(id)
	format(name[id],SIZE_OF_NAME,"")
	
}

public client_putinserver(id)
{	
	rem_user_auto_aim(id)
	rem_user_auto_shoot(id)
	
	if(get_pcvar_num(c_Aim_Always_On)>0)
	{
		set_auto_aim(id)
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] %s has autoaim by default",name[id])
		else
			log_to_file(p_Log_File,"%s has autoaim by default",name[id])
	
	}
	else
		rem_auto_aim(id)
		
	if(get_pcvar_num(c_AutoShoot_Always_On)>0)
	{
		set_auto_shoot(id)
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] %s has autoshoot by default",name[id])
		else
			log_to_file(p_Log_File,"%s has autoshoot by default",name[id])
	}
	else
		rem_auto_shoot(id)
	get_user_info(id, "name", name[id], SIZE_OF_NAME)
	
}
public client_infochanged(id)
{
	if(is_user_connected(id)&&!is_user_bot(id))
	{
		get_user_info(id, "name", name[id], SIZE_OF_NAME)
	}
	return PLUGIN_HANDLED
}


public Who_Use_It(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	for(new Player=1;Player<=get_maxplayers();Player++)
	{
		if(has_auto_shoot(Player))
		{
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_PLAYER_WITH_AUTOSHOOT",name[Player])
		}
		if(has_auto_aim(Player))
		{
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_PLAYER_WITH_AUTOAIM",name[Player])
		}
	}
	return PLUGIN_HANDLED
}



public ServerAim_Switch(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	new argc=read_argc();
	new Command[20]
	read_argv(0,Command,sizeof(Command))
	if(argc!=2)
	{
		console_print(id,"Usage: %s <1|0>",Command)
		return PLUGIN_HANDLED
	}
	new s_Value[2]
	read_argv(1,s_Value,sizeof(s_Value))
	if(equali(s_Value, "1"))
	{
		if(forwardID!=0)
		{
			console_print(id,"%L",LANG_PLAYER, "SERVERAIM_ALREADY_TURNED_ON")
			return PLUGIN_HANDLED
		}
		forwardID=register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0)
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] ADMIN %s turned on ServerAimBot",name[id])
		else
			log_to_file(p_Log_File,"ADMIN %s turned on ServerAimBot",name[id])
			
		if(get_pcvar_num(c_Show_Admin)==0)
		client_print(id,print_console,"%L",LANG_PLAYER,"ADM_SERVERAIM_TURNED_ON")
		if(get_pcvar_num(c_Show_Admin)==1)
		client_print(0,print_chat,"%L",LANG_PLAYER,"SERVERAIM_TURNED_ON")
		if(get_pcvar_num(c_Show_Admin)==2)
		client_print(0,print_chat,"%L",LANG_PLAYER,"SERVERAIM_TURNED_ON_BY",name[id])
	}
	else
	if(equali(s_Value, "0"))
	{
		if(forwardID==0)
		{
			console_print(id,"%L",LANG_PLAYER, "SERVERAIM_ALREADY_TURNED_OFF")
			return PLUGIN_HANDLED
		}
		unregister_forward(FM_PlayerPreThink,forwardID,0)
		
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] ADMIN %s turned off ServerAimBot",name[id])
		else
			log_to_file(p_Log_File,"ADMIN %s turned off ServerAimBot",name[id])
			
		if(get_pcvar_num(c_Show_Admin)==0)
		client_print(id,print_console,"%L",LANG_PLAYER,"ADM_SERVERAIM_TURNED_OFF")
		if(get_pcvar_num(c_Show_Admin)==1)
		client_print(0,print_chat,"%L",LANG_PLAYER,"SERVERAIM_TURNED_OFF")
		if(get_pcvar_num(c_Show_Admin)==2)
		client_print(0,print_chat,"%L",LANG_PLAYER,"SERVERAIM_TURNED_OFF_BY",name[id])
		forwardID=0
	}
	return PLUGIN_HANDLED
}



public  fwdPlayerPreThink(id)
{	
	if(has_auto_aim(id)&&is_user_alive(id))
	{
		if(has_user_auto_aim(id)||get_pcvar_num(c_Button_Mode)==0)
		{	
			get_user_origin(id,player_head[id],0)
			Targets_Can_Be_Shooted_Counter[id]=0
			for(new Target=1;Target<=get_maxplayers();Target++)
			{
				if(is_user_alive(Target))
				{
					if(is_enemy(id,Target))
					{
						if(is_player_visible(id,Target))
						{	
							get_user_origin(Target,player_head[Target],0)
							player_head[Target][2]-=get_pcvar_num(c_Correction)
							Targets_Can_Be_Shooted[id][Targets_Can_Be_Shooted_Counter[id]]=Target
							Targets_Can_Be_Shooted_Counter[id]++
							if(Aim_Debug>2)
							{	
								GET_SMALL_TIME
								fprintf(Debug_File,"^n___________%s____________^n",Current_Time)
								fprintf(Debug_File,"ID=%i (%s), {%i, %i, %i}^n",id,name[id],player_head[id][0],player_head[id][1],player_head[id][2])
								fprintf(Debug_File,"Target=%i (%s), {%i, %i, %i}^n",Target,name[Target],player_head[Target][0],player_head[Target][1],player_head[Target][2])
							}
							target_diff[id][Target][0]=player_head[id][0]-player_head[Target][0]
							target_diff[id][Target][1]=player_head[id][1]-player_head[Target][1]
							target_diff[id][Target][2]=player_head[id][2]-player_head[Target][2]						
							if(Aim_Debug>3)
							{
								fprintf(Debug_File,"Differense between targets [%s][%s]={%i, %i, %i}^n",name[id],name[Target],target_diff[id][Target][0],target_diff[id][Target][1],target_diff[id][Target][2])
							}					
							//target_dist_xy[id][Target]=floatsqroot(floatadd( floatpower(floatsub(float(player_head[id][0]),float(player_head[Target][0])),2.0),floatpower(floatsub(float(player_head[id][1]),float(player_head[Target][1])),2.0)))
							/*target_dist[id][Target]=floatsqroot(floatadd(floatadd( floatpower(floatsub(float(player_head[id][0]),float(player_head[Target][0])),2.0),floatpower(floatsub(float(player_head[id][1]),float(player_head[Target][1])),2.0)),floatpower(floatsub(float(player_head[id][2]),float(player_head[Target][2])),2.0)))
							if(Aim_Debug>3)
							{
								fprintf(Debug_File,"target_dist_xy[%s][%s]=%f^n",name[id],name[Target],target_dist_xy[id][Target])
								fprintf(Debug_File,"target_dist[%s][%s]=%f^n",name[id],name[Target],target_dist[id][Target])
							}			
							*/
							//target_vector[id][Target][0]=floatatan(floatdiv(float(target_diff[id][Target][2]),target_dist_xy[id][Target]),degrees)
							target_vector[id][Target][0]=floatatan(floatdiv(float(target_diff[id][Target][2]),floatsqroot(floatadd(floatadd( floatpower(floatsub(float(player_head[id][0]),float(player_head[Target][0])),2.0),floatpower(floatsub(float(player_head[id][1]),float(player_head[Target][1])),2.0)),floatpower(floatsub(float(player_head[id][2]),float(player_head[Target][2])),2.0)))),degrees)	
							if(Aim_Debug>3)
							{
								fprintf(Debug_File,"target_vector[%s][%s][0]=%f^n",name[id],name[Target],target_vector[id][Target][0])
							}
							if(target_diff[id][Target][0]==0&&target_diff[id][Target][1]>0)//x==0,y>0
							{
								target_vector[id][Target][1]=float(-90)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}					
							if(target_diff[id][Target][0]==0&&target_diff[id][Target][1]<0)//x==0,y<0
							{
								target_vector[id][Target][1]=float(90)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}
							else
							if(target_diff[id][Target][0]>0&&target_diff[id][Target][1]==0)//x>0,y==0
							{
								target_vector[id][Target][1]=float(180)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}
							else
							if(target_diff[id][Target][0]<0&&target_diff[id][Target][1]==0)//x<0,y==0
							{
								target_vector[id][Target][1]=float(0)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}
							else
							if(target_diff[id][Target][0]==0&&target_diff[id][Target][1]==0)//x==0,y==0
							{
								target_vector[id][Target][1]=float(0)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}
							else
							if(target_diff[id][Target][0]<0&&target_diff[id][Target][1]!=0)//x<0,y!=0
							{
								target_vector[id][Target][1]=floatatan(floatdiv(float(target_diff[id][Target][1]),float(target_diff[id][Target][0])),degrees)
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}
							else
							if(target_diff[id][Target][0]>0&&target_diff[id][Target][1]!=0)//x>0,y!=0
							{
								target_vector[id][Target][1]=floatadd(float(180),floatatan(floatdiv(float(target_diff[id][Target][1]),float(target_diff[id][Target][0])),degrees))
								if(Aim_Debug>3)
								{
									fprintf(Debug_File,"target_vector[%s][%s][1]=%f^n",name[id],name[Target],target_vector[id][Target][1])
								}
							}	
							
						}
						else
						{
							if(Aim_Debug>6)
							{
								GET_SMALL_TIME
								fprintf(Debug_File,"^n___________%s____________^n",Current_Time)
								fprintf(Debug_File,"ID=%i (%s), {%i, %i, %i}^n",id,name[id],player_head[id][0],player_head[id][1],player_head[id][2])
								fprintf(Debug_File,"Target=%i (%s), {%i, %i, %i}^n",Target,name[Target],player_head[Target][0],player_head[Target][1],player_head[Target][2])
								fprintf(Debug_File,"Target not visible ^n")
							}
						}
					}
				}
			}
			if(Targets_Can_Be_Shooted_Counter[id]>0)
			{
				if(Aim_Debug>5)
				{
					fprintf(Debug_File,"____Aiming <%s>-----><%s>------>^n",name[id],name[find_nearest(id)])
				}
				entity_set_vector(id, EV_VEC_angles, target_vector[id][find_nearest(id)])
				entity_set_int(id, EV_INT_fixangle, 1)
			}
		}
	}
	if(has_auto_shoot(id))
	{
		if(has_user_auto_shoot(id)||get_pcvar_num(c_Button_Mode)==0)
		{
			if(is_user_alive(id))
			{
				new Target, body
				get_user_aiming(id, Target, body, 9999)
				if( 0 < Target <= get_maxplayers())
				{
					if(is_enemy(id,Target)&&is_player_visible(id,Target))
					{
						if(is_user_alive(Target))
						{
							set_pev(id,pev_punchangle,{ 0.0,0.0,0.0 });
							if(get_pcvar_num(c_NoDamage)==1)
							{
								set_user_hitzones(id,0,0)
							}
							if(Aim_Debug>2)
							{
								GET_SMALL_TIME
								fprintf(Debug_File,"[Autoshoot] %s : %s shootded at %s^n",Current_Time,name[id],name[Target])
							}
							iWeaponEnt[id] = w;
							if(get_pcvar_num(c_Inf_Ammo)==1&&is_valid_ent(iWeaponEnt[id]))
							{
								if(cs_get_weapon_ammo (iWeaponEnt[id])<2)
									cs_set_weapon_ammo(iWeaponEnt[id],7)
							}
							if(get_pcvar_num(c_Attack_Mode)<=0)
							{
								if(!is_shooting(id))
								{
									client_cmd(id,"+attack")
									set_shooting(id)
								}
							}
							if(get_pcvar_num(c_Attack_Mode)>0)
							{
								
								if(frame_counter[id]==0)
								{
									frame_counter[id]++
									if(is_valid_ent(iWeaponEnt[id]))
										ExecuteHam( Ham_Weapon_PrimaryAttack , iWeaponEnt[id]);
								}
								else 
								{
									frame_counter[id]++
									if(frame_counter[id]>=get_pcvar_num(c_Frame_Delay))
										frame_counter[id]=0
								}
							}
							set_pev(id,pev_punchangle,{ 0.0,0.0,0.0 });

						}
				
					}
					
				}
				else
				{
					frame_counter[id]=0
					if(is_shooting(id)&&get_pcvar_num(c_Attack_Mode)<=0)
					{
						client_cmd(id,"-attack")
						stop_shooting(id)
					}
					
					if(get_pcvar_num(c_NoDamage)==1)
					{
						set_user_hitzones(id,0,255)
					}	
				}
			}
		}

	}
}



public is_enemy (Player1,Player2)
{
	if(get_user_team(Player1)==get_user_team(Player2) )
		return 0
	else 
		return 1	
	return PLUGIN_HANDLED
}



public  Aim_Debug_Switch(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	new argc=read_argc();
	new Command[20]
	read_argv(0,Command,sizeof(Command))
	if(argc!=2)
	{
		console_print(id,"Usage: %s <1|0>",Command)
		return PLUGIN_HANDLED
	}
	new s_Value[10]
	read_argv(1,s_Value,sizeof(s_Value))
	if(str_to_num(s_Value)>0)
	{
		if(Aim_Debug>0)
		{
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_DEBUG_MODE_ALREADY_TURNED_ON")
			return PLUGIN_HANDLED
		}

		GET_FULL_TIME
		format(p_Debug_File, sizeof(p_Debug_File), "%s/%s.log", p_Debug_Dir,Current_Time)
		if(file_exists(p_Debug_File))//Я понятия не имею, как такое возможно.
			Debug_File=fopen(p_Debug_File,"at")
		else
			Debug_File=fopen(p_Debug_File,"wt")//
		Aim_Debug=str_to_num(s_Value)
		
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] ADMIN %s turned on ServerAimBot debug mode %i.",name[id],str_to_num(s_Value))
		else
			log_to_file(p_Log_File,"ADMIN %s turned on ServerAimBot debug mode %i.",name[id],str_to_num(s_Value))
		if(get_pcvar_num(c_Show_Admin)==0)
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_DEBUG_MODE_TURNED_ON")
		if(get_pcvar_num(c_Show_Admin)==1)
			client_print(0,print_chat,"%L",LANG_PLAYER,"DEBUG_MODE_TURNED_ON")
		if(get_pcvar_num(c_Show_Admin)==2)
			client_print(0,print_chat,"%L",LANG_PLAYER,"DEBUG_MODE_TURNED_ON_BY",name[id])
		get_time("%d %B %Y %X", Current_Time, sizeof(Current_Time))
		fprintf(Debug_File,"Log file started at %s^n",Current_Time)
	}
	else
	if(str_to_num(s_Value)==0)
	{
		if(Aim_Debug==0)
		{
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_DEBUG_MODE_ALREADY_TURNED_OFF")
			return PLUGIN_HANDLED
		}
		Aim_Debug=0
		
		if(get_pcvar_num(c_AlliedModders_rules)==1)
			log_amx("[ServerAimBot] ADMIN %s turned off ServerAimBot debug mode.",name[id])
		else
			log_to_file(p_Log_File,"ADMIN %s turned off ServerAimBot debug mode.",name[id])
			
		get_time("%d %B %Y %X", Current_Time, sizeof(Current_Time))
		fprintf(Debug_File,"^n^nLog file closed at %s^n",Current_Time)
		fclose(Debug_File)
		if(get_pcvar_num(c_Show_Admin)==0)
			client_print(id,print_console,"%L",LANG_PLAYER,"ADM_DEBUG_MODE_TURNED_OFF")
		if(get_pcvar_num(c_Show_Admin)==1)
			client_print(0,print_chat,"%L",LANG_PLAYER,"DEBUG_MODE_TURNED_OFF")
		if(get_pcvar_num(c_Show_Admin)==2)
			client_print(0,print_chat,"%L",LANG_PLAYER,"DEBUG_MODE_TURNED_OFF_BY",name[id])
	}
	else
	{
		console_print(id,"Usage: %s <1|0>",Command)
		return PLUGIN_HANDLED
	}
	return PLUGIN_HANDLED
}


public AutoShoot_Function_Switch(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	new argc=read_argc();
	new Command[20]
	read_argv(0,Command,sizeof(Command))
	if(argc!=3)
	{
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	new Target[10],s_Value[10]
	
	read_argv(1,Target,sizeof(Target))
	read_argv(2,s_Value,sizeof(s_Value))
	new Value
	Value=str_to_num(s_Value)
	if(Value!=0&&Value!=1)
	{
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	
		
	if (Target[0] == '@')
	{			
		new Team = 0
		if (equali(Target[1], "CT"))
		{
			if(Value==1)
			{	
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoshoot for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoshoot for all CT.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoshoot for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoshoot for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoshoot for all CT.",name[id])
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoshoot for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			Team = 2
		} 
		else
		if (equali(Target[1], "T"))
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoshoot for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoshoot for all T.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoshoot for all Terrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoshoot for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoshoot for all T.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoshoot for all Terrorists^n",Current_Time,name[id])
				}
			}
			Team = 1
		}
		else
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoshoot for everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoshoot for everybody.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoshoot for everybody^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoshoot for all everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoshoot for all everybody.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoshoot for everybody^n",Current_Time,name[id])
				}
			}
		}		
		new Players[32], Number_Of_Players
		get_players(Players, Number_Of_Players)
		for (new Player=0; Player<Number_Of_Players; Player++)
		{
			if (!Team)
			{
				if(is_user_connected(Players[Player]))
				{
					if(Value==1)
					{
						set_auto_shoot(Players[Player])
						//log_to_file(p_Log_File,"ADMIN %s turned on autoshoot for %s.",name[id],name[Players[Player]])
					}
					else
					{
						rem_auto_shoot(Players[Player])
						//log_to_file(p_Log_File,"ADMIN %s turned off autoshoot for %s.",name[id],name[Players[Player]])
					}
					if(Aim_Debug>1)
					{
						GET_SMALL_TIME
						if(Value==1)
							fprintf(Debug_File,"%s:Autoshoot turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						else
							fprintf(Debug_File,"%s:Autoshoot turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
					}
				}
			} 
			else 
			{
				if (get_user_team(Players[Player]) == Team)
				{
					if(is_user_connected(Players[Player]))
					{
						if(Value==1)
							set_auto_shoot(Players[Player])
						else
							rem_auto_shoot(Players[Player])
						if(Aim_Debug>1)
						{
							GET_SMALL_TIME
							if(Value==1)
								fprintf(Debug_File,"%s:Autoshoot turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
							else
								fprintf(Debug_File,"%s:Autoshoot turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						}
					}
				}
			}
		}
	} 
	else 
	{
		new Player = cmd_target(id, Target, 2)
		if (!Player)
		{
			console_print(id, "Sorry, player %s could not be found or targetted!", Target)
			return PLUGIN_HANDLED
		} 
		else
		{
			if(Value==1)
			{	
				set_auto_shoot(Player)
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoshoot for %s.",name[id],name[Player])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoshoot for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_ON",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_ON_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoshoot for %s^n",Current_Time,name[id],name[Player])
				}
			}
			else
			{
				rem_auto_shoot(Player)
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoshoot for %s.",name[id],name[Player])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoshoot for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOSHOOT_OFF",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOSHOOT_OFF_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoshoot for %s^n",Current_Time,name[id],name[Player])
				}
			}
			
		}
	}
	
	return PLUGIN_HANDLED
}

public AutoAim_Function_Switch(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	new argc=read_argc();
	new Command[20]
	read_argv(0,Command,sizeof(Command))
	if(argc!=3)
	{	
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	new Target[10],s_Value[10]
	
	read_argv(1,Target,sizeof(Target))
	read_argv(2,s_Value,sizeof(s_Value))
	new Value
	Value=str_to_num(s_Value)
	if(Value!=0&&Value!=1)
	{
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	
		
	if (Target[0] == '@')
	{		
		
		new Team = 0
		if (equali(Target[1], "CT"))
		{
			if(Value==1)
			{	
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoaim for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoaim for all CT.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoaim for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoaim for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoaim for all CT.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoaim for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			Team = 2
		} 
		else
		if (equali(Target[1], "T"))
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoaim for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoaim for all T.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoaim for all Terrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoaim for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoaim for all T.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoaim for all Terrorists^n",Current_Time,name[id])
				}
			}
			Team = 1
		}
		else
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoaim for everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoaim for everybody.",name[id])
				
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoaim for everybody^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoaim for everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoaim for everybody.",name[id])
				
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoaim for everybody^n",Current_Time,name[id])
				}
			}
		}		
		new Players[32], Number_Of_Players
		get_players(Players, Number_Of_Players)		
		for (new Player=0; Player<Number_Of_Players; Player++)
		{
			if (!Team)
			{
				if(is_user_connected(Players[Player]))
				{
					if(Value==1)
						set_auto_aim(Players[Player])
					else
						rem_auto_aim(Players[Player])
					if(Aim_Debug>1)
					{
						GET_SMALL_TIME
						if(Value==1)
							fprintf(Debug_File,"%s:Autoaim turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						else
							fprintf(Debug_File,"%s:Autoaim turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
					}
				}
			} 
			else 
			{
				if (get_user_team(Players[Player]) == Team)
				{
					if(is_user_connected(Players[Player]))
					{
						if(Value==1)
							set_auto_aim(Players[Player])
						else
							rem_auto_aim(Players[Player])
						if(Aim_Debug>1)
						{
							GET_SMALL_TIME
							if(Value==1)
								fprintf(Debug_File,"%s:Autoaim turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
							else
								fprintf(Debug_File,"%s:Autoaim turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						}
					}
				}
			}
		}
	} 
	else 
	{
		new Player = cmd_target(id, Target, 2)
		if (!Player)
		{
			console_print(id, "Sorry, player %s could not be found or targetted!", Target)
			return PLUGIN_HANDLED
		} 
		else
		{
			if(Value==1)
			{	
				set_auto_aim(Player)
				
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on autoaim for %s.",name[id],name[Player])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on autoaim for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_ON",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_ON_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoaim for %s^n",Current_Time,name[id],name[Player])
				}
			}
			else
			{
				rem_auto_aim(Player)
				
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off autoaim for %s.",name[id],name[Player])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off autoaim for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AUTOAIM_OFF",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AUTOAIM_OFF_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoaim for %s^n",Current_Time,name[id],name[Player])
				}
			}
			
		}
	}	
	return PLUGIN_HANDLED
}
public AimBot_Function_Switch(id, level, cid)
{
	if(!(get_user_flags(id) & ADMIN_REQUIRED))
		return PLUGIN_HANDLED
	new argc=read_argc();
	new Command[20]
	read_argv(0,Command,sizeof(Command))
	if(argc!=3)
	{	
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	new Target[10],s_Value[10]
	
	read_argv(1,Target,sizeof(Target))
	read_argv(2,s_Value,sizeof(s_Value))
	new Value
	Value=str_to_num(s_Value)
	if(Value!=0&&Value!=1)
	{
		console_print(id,"Usage: %s <@|@CT|@T|#id|name> <1|0>",Command)
		return PLUGIN_HANDLED
	}
	
		
	if (Target[0] == '@')
	{		
		
		new Team = 0
		if (equali(Target[1], "CT"))
		{
			if(Value==1)
			{	
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on aimbot for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on aimbot for all CT.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on aimbot for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off aimbot for all CT.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off aimbot for all CT.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_CT")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL_CT")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_CT")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_CT")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL_CT_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off aimbot for all CounterTerrorists^n",Current_Time,name[id])
				}
			}
			Team = 2
		} 
		else
		if (equali(Target[1], "T"))
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on aimbot for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on aimbot for all T.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on aimbot for all Terrorists^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off aimbot for all T.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off aimbot for all T.",name[id])
				
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_T")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL_T")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_T")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL_T")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL_T_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off autoaim for all Terrorists^n",Current_Time,name[id])
				}
			}
			Team = 1
		}
		else
		{
			if(Value==1)
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on aimbot for everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on aimbot for everybody.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on autoaim for everybody^n",Current_Time,name[id])
				}
			}
			else
			{
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off aimbot for everybody.",name[id])
				else
					log_to_file(p_Log_File,"ADMIN %s turned off aimbot for everybody.",name[id])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL")
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL")
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL")
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF_ALL")	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_ALL_BY",name[id])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off aimbot for everybody^n",Current_Time,name[id])
				}
			}
		}		
		new Players[32], Number_Of_Players
		get_players(Players, Number_Of_Players)		
		for (new Player=0; Player<Number_Of_Players; Player++)
		{
			if (!Team)
			{
				if(is_user_connected(Players[Player]))
				{
					if(Value==1)
					{
						set_auto_aim(Players[Player])
						set_auto_shoot(Players[Player])
					}
					else
					{
						rem_auto_aim(Players[Player])
						rem_auto_shoot(Players[Player])
					}
					if(Aim_Debug>1)
					{
						GET_SMALL_TIME
						if(Value==1)
							fprintf(Debug_File,"%s:Aimbot turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						else
							fprintf(Debug_File,"%s:Aimbot turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
					}
				}
			} 
			else 
			{
				if (get_user_team(Players[Player]) == Team)
				{
					if(is_user_connected(Players[Player]))
					{
						if(Value==1)
						{
							set_auto_aim(Players[Player])
							set_auto_shoot(Players[Player])
						}
						else
						{
							rem_auto_aim(Players[Player])
							rem_auto_shoot(Players[Player])
						}
						if(Aim_Debug>1)
						{
							GET_SMALL_TIME
							if(Value==1)
								fprintf(Debug_File,"%s:Aimbot turned on for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
							else
								fprintf(Debug_File,"%s:Aimbot turned off for %s.Bitsum_Use_Auto_Aim=%i. Bitsum_Use_Auto_Shoot=%i^n",Current_Time,name[Players[Player]],Bitsum_Use_Auto_Aim,Bitsum_Use_Auto_Shoot)
						}
					}
				}
			}
		}
	} 
	else 
	{
		new Player = cmd_target(id, Target, 2)
		if (!Player)
		{
			console_print(id, "Sorry, player %s could not be found or targetted!", Target)
			return PLUGIN_HANDLED
		} 
		else
		{
			if(Value==1)
			{
				set_auto_aim(Player)
				set_auto_shoot(Player)
				
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned on aimbot for %s.",name[id],name[Player])
				else
					log_to_file(p_Log_File,"ADMIN %s turned on aimbot for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_ON",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_ON_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned on aimbot for %s^n",Current_Time,name[id],name[Player])
				}
			}
			else
			{
				rem_auto_aim(Player)
				rem_auto_shoot(Player)
				
				if(get_pcvar_num(c_AlliedModders_rules)==1)
					log_amx("[ServerAimBot] ADMIN %s turned off aimbot for %s.",name[id],name[Player])
				else				
					log_to_file(p_Log_File,"ADMIN %s turned off aimbot for %s.",name[id],name[Player])
					
				if(get_pcvar_num(c_Show_Admin)==0)
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF",name[Player])
				if(get_pcvar_num(c_Show_Admin)==1)
				{
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF",name[Player])
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF",name[Player])
				}
				if(get_pcvar_num(c_Show_Admin)==2)
				{
					client_print(id,print_console,"%L",LANG_PLAYER,"ADM_AIMBOT_OFF",name[Player])	
					client_print(0,print_chat,"%L",LANG_PLAYER,"AIMBOT_OFF_BY",name[id],name[Player])
				}
				if(Aim_Debug>0)
				{
					GET_SMALL_TIME
					fprintf(Debug_File,"%s:%s turned off aimbot for %s^n",Current_Time,name[id],name[Player])
				}
			}
			
		}
	}	
	return PLUGIN_HANDLED
}

	//<stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
		public fw_spawn(ent) 
		{ 
			if (!pev_valid(ent)) 
				return FMRES_IGNORED 
			 
			static rendermode, Float:renderamt 
			 
			rendermode = pev(ent, pev_rendermode) 
			pev(ent, pev_renderamt, renderamt) 
			 
			// Если объект прозрачный, добавить в список
			if (((rendermode == kRenderTransColor || rendermode == kRenderGlow || rendermode == kRenderTransTexture) && renderamt < 255.0) || (rendermode == kRenderTransAdd)) 
			{ 
				add_transparent_ent(ent) 
				return FMRES_IGNORED 
			} 
			 
			return FMRES_IGNORED 
		} 
		// Проверяет является ли точка видимой от начало до нее. Игнорируются стекло, игроки и ignore_ent. 
		bool:is_point_visible(const Float:start[3], const Float:point[3], ignore_ent) 
		{ 
			engfunc(EngFunc_TraceLine, start, point, IGNORE_GLASS | IGNORE_MONSTERS, ignore_ent, thdl) 

			static Float:fraction 
			get_tr2(thdl, TR_flFraction, fraction) 
			 
			// Возвращение результата
			// Если 1, значит мы ничего не коснулись 
			return (fraction == 1.0) 
		} 

		// Тоже самое, что и верхняя функция, только проверяем объект, который мы коснулись и через который можно видеть
		bool:is_point_visible_texture(const Float:start[3], const Float:point[3], ignore_ent) 
		{ 
			engfunc(EngFunc_TraceLine, start, point, IGNORE_GLASS | IGNORE_MONSTERS, ignore_ent, thdl) 
			 
			// Сохраняем объект
			static ent 
			ent = get_tr2(thdl, TR_pHit) 

			static Float:fraction 
			get_tr2(thdl, TR_flFraction, fraction) 
			 
			// Если мы ударили что-то, то начать проверку
			if (fraction != 1.0 && ent > 0) 
			{ 
				// Это означает, что мы не знаем, чего мы коснулись
				if (!is_transparent_ent(ent) && !is_solid_ent(ent)) 
				{ 
					static texture_name[2] 
					static Float:vec[3] 
					// Эти вычисления сделаны в целях безопасности
					// функция TraceTexture будет убивать сервер на маленький дистанциях
					xs_vec_sub(point, start, vec) 
					xs_vec_mul_scalar(vec, (5000.0 / xs_vec_len(vec)), vec) 
					xs_vec_add(start, vec, vec) 
					 
					engfunc(EngFunc_TraceTexture, ent, start, vec, texture_name, charsmax(texture_name)) 
					 
					// Если texture_name начинается с { - это означает, что у нас прозрачная текстура,  
					// если да, то мы делаем перетрассировку и добавляем данный объект, как прозрачный.  
					// Если нет, то мы добавляем объект, как непрозрачный и следовательно нам не нужно его снова проверять.
					if (equal(texture_name, "{")) 
					{ 
						add_transparent_ent(ent) 
						ignore_ent = ent 
						engfunc(EngFunc_TraceLine, start, point, IGNORE_GLASS | IGNORE_MONSTERS, ignore_ent, thdl) 
						get_tr2(thdl, TR_flFraction, fraction) 
						return (fraction == 1.0) 
					} 
					else 
					{ 
						add_solid_ent(ent) 
						return (fraction == 1.0) 
					} 
				} 
				// Это означает, что объект или прозрачный, или нет
				else 
				{ 
					if (is_solid_ent(ent)) 
					{ 
						return (fraction == 1.0) 
					} 
					else 
					{ 
						ignore_ent = ent 
						engfunc(EngFunc_TraceLine, start, point, IGNORE_GLASS | IGNORE_MONSTERS, ignore_ent, thdl) 
						get_tr2(thdl, TR_flFraction, fraction) 
						return (fraction == 1.0) 
					} 
				} 
			} 
			 
			return (fraction == 1.0) 
		} 
		 stock is_player_visible(visor, target) 
		{ 
			// Объявления
			static Float:origin[3], Float:start[3], Float:end[3], Float:addict[3], Float:plane_vec[3], Float:normal[3], ignore_ent 
			 
			// Игнорирумый объект - visor. В данном случае используем его в качестве теста.
			ignore_ent = visor 
			 
			// Проверяем находится ли игрок позади объекта visor
			// Получаем координаты visor 
			pev(visor, pev_origin, origin) 
			 
			// Получаем угол наклона visor 
			pev(visor, pev_v_angle, normal) 

			// Конвертируем вектор
			angle_vector(normal, ANGLEVECTOR_FORWARD, normal) 
			 
			// Получаем коодиранты цели
			pev(target, pev_origin, end) 

			// Делаем вычитание векторов дял получения одного вектора
			xs_vec_sub(end, origin, plane_vec) 

			// Получаем реальные данные между двумя векторами 
			xs_vec_mul_scalar(plane_vec,  (1.0/xs_vec_len(plane_vec)), plane_vec) 
			 
			// После умножение двух векторов их длина равняется 1
			// Вычисляем косинус угла между ними, если он будет отрицательным - значит игрок находится позади, возвращаем false
			if (xs_vec_dot(plane_vec, normal) < 0) 
			{ 
				return false 
			} 
			 
			// Получаем смещение обзора visor и добавляем их к координатам для получения координат глаз
			pev(visor, pev_view_ofs, start) 
			xs_vec_add(start, origin, start) 
			 
			// Начало становится концом
			origin = end 
			 
			// Теперь у нас есть 2 важных вектора:
			// start - координаты глаз объекта visor 
			// origin - коодинаты цели
			 
			// Это используется один раз для обновления ignore_ent 
			// Если точка видна, то возвращаем true
			if (is_point_visible_texture(start, origin, ignore_ent)) 
				return true 
			 
			// Получаем смещение обзора цели и добавляем их к координатам для получения координат глаз
			pev(target, pev_view_ofs, end) 
			xs_vec_add(end, origin, end) 
			 
			// Если точка видна, возвращаем true
			if (is_point_visible(start, end, ignore_ent)) 
				return true 
			 
			// Проверяем точку оружия. Сначала проверяем, чтобы она не была равна нулю
			if (weapon_edge_point[get_user_weapon(target)] != 0.00) 
			{ 
				// Получаем угол обзора и конвектируем в вектор
				pev(target, pev_v_angle, addict) 
				angle_vector(addict, ANGLEVECTOR_FORWARD, addict) 
				// Перемножаем их для получения головной точки оружия 
				xs_vec_mul_scalar(addict, weapon_edge_point[get_user_weapon(target)], addict) 
				// Добавляем их в конец координат для получения головной точки 
				xs_vec_add(end, addict, end) 
				 
				// Если точка оружия видна, то возвращаем true
				if (is_point_visible(start, end, ignore_ent)) 
					return true 
			} 
			 
			// Делаем вычитание
			xs_vec_sub(start, origin, normal) 
			 
			// У нас есть вектор:
			// normal - вектор между начальным вектором и координатами цели
			 
			// Делаем проверку плоскости
			// Данные функции создадут плоскость, которая будет крутиться на основании позиции игрока
			// Проверять будем точки, которые сущестуют на плоскости
			 
			// Нормализуем normal вектор
			// Это важно при проблемах с высотой
			xs_vec_mul_scalar(normal, 1.0/(xs_vec_len(normal)), normal) 
			// Конвертируем в угловой вектор
			vector_to_angle(normal, plane_vec) 
			// Создаем вектор, который перпендикулярен normal вектору
			angle_vector(plane_vec, ANGLEVECTOR_RIGHT, plane_vec) 
			 
			// Проверяем, находимся ли мы на том же уровне с целью
			if (floatabs(normal[2]) <= ANGLE_COS_HEIGHT_CHECK) 
			{ 
				// Проверяем, присели ли цель
				// Создаем плоскость
				if (pev(target, pev_flags) & FL_DUCKING) 
				{ 
					for (new i=0;i<4;i++) 
					{ 
						if (i<2) 
						{ 
							for (new j=0;j<2;j++) 
							{ 
								// Перемножаем вектора и добавляем к координатам для проверки видимости
								// Тоже самое будет происходить и дальше
								xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
								addict[2] = vec_add_height_crouch[j] 
								xs_vec_add(origin, addict, end) 
								 
								if (is_point_visible(start, end, ignore_ent)) 
									return true 
							} 
						} 
						else 
						{ 
							for (new j=2;j<4;j++) 
							{ 
								xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
								addict[2] = vec_add_height_crouch[j] 
								xs_vec_add(origin, addict, end) 
								 
								if (is_point_visible(start, end, ignore_ent)) 
									return true 
							} 
						} 
					} 
				} 
				else 
				{ 
					for (new i=0;i<4;i++) 
					{ 
						if (i<2) 
						{ 
							for (new j=0;j<2;j++) 
							{ 
								xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
								addict[2] = vec_add_height_standup[j] 
								xs_vec_add(origin, addict, end) 
								 
								if (is_point_visible(start, end, ignore_ent)) 
									return true 
							} 
						} 
						else 
						{ 
							for (new j=2;j<4;j++) 
							{ 
								xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
								addict[2] = vec_add_height_standup[j] 
								xs_vec_add(origin, addict, end) 
								 
								if (is_point_visible(start, end, ignore_ent)) 
									return true 
							} 
						} 
					} 
				} 
			} 
			else 
			{ 
				// Единственное различие с предыдущим кодом - это использование normal вектора для перемещения точек вперед и назад
				// Проверяем выше ли мы игрока
				if (normal[2] > 0.0) 
				{ 
					normal[2] = 0.0 
					xs_vec_mul_scalar(normal, 1/(xs_vec_len(normal)), normal) 
				 
					if (pev(target, pev_flags) & FL_DUCKING) 
					{ 
						for (new i=0;i<4;i++) 
						{ 
							if (i<2) 
							{ 
								for (new j=0;j<2;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_crouch[j] 
									xs_vec_add(origin, addict, end) 
									xs_vec_mul_scalar(normal, (j == 0) ? (-GENERAL_X_Y_SORROUNDING) : (GENERAL_X_Y_SORROUNDING), addict) 
									xs_vec_add(end, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
							else 
							{ 
								for (new j=2;j<4;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_crouch[j] 
									xs_vec_add(origin, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
						} 
					} 
					else 
					{ 
						for (new i=0;i<4;i++) 
						{ 
							if (i<2) 
							{ 
								for (new j=0;j<2;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_standup[j] 
									xs_vec_add(origin, addict, end) 
									xs_vec_mul_scalar(normal, (j == 0) ? (-GENERAL_X_Y_SORROUNDING) : (GENERAL_X_Y_SORROUNDING), addict) 
									xs_vec_add(end, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
							else 
							{ 
								for (new j=2;j<4;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_standup[j] 
									xs_vec_add(origin, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
						} 
					} 
				} 
				else 
				{ 
					normal[2] = 0.0 
					xs_vec_mul_scalar(normal, 1/(xs_vec_len(normal)), normal) 
					 
					if (pev(target, pev_flags) & FL_DUCKING) 
					{ 
						for (new i=0;i<4;i++) 
						{ 
							if (i<2) 
							{ 
								for (new j=0;j<2;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_crouch[j] 
									xs_vec_add(origin, addict, end) 
									xs_vec_mul_scalar(normal, (j == 0) ? GENERAL_X_Y_SORROUNDING : (-GENERAL_X_Y_SORROUNDING), addict) 
									xs_vec_add(end, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
							else 
							{ 
								for (new j=2;j<4;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_crouch[j] 
									xs_vec_add(origin, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
						} 
					} 
					else 
					{ 
						for (new i=0;i<4;i++) 
						{ 
							if (i<2) 
							{ 
								for (new j=0;j<2;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_standup[j] 
									xs_vec_add(origin, addict, end) 
									xs_vec_mul_scalar(normal, (j == 0) ? GENERAL_X_Y_SORROUNDING : (-GENERAL_X_Y_SORROUNDING), addict) 
									xs_vec_add(end, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
							else 
							{ 
								for (new j=2;j<4;j++) 
								{ 
									xs_vec_mul_scalar(plane_vec, vec_multi_lateral[i], addict) 
									addict[2] = vec_add_height_standup[j] 
									xs_vec_add(origin, addict, end) 
									 
									if (is_point_visible(start, end, ignore_ent)) 
										return true 
								} 
							} 
						} 
					} 
				} 
			} 
			 
			// Цель не видна
			return false 
		} 
	//</stock is_player_visible by ot_207|Translated by DJ_WEST http://amx-x.ru/viewtopic.php?f=9&t=73 >
	
public Create_Config()
{
	new config=fopen(p_Config_File,"wt")
	fprintf(config,"//Use ServerAim always (1) or only when admin turns it on with ^"aim 1^"(0)^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"//Держать ServerAim включённым всегда(1), или только тогда, когда админ включит его коммандой ^"aim 1^"(0)^n")
	fprintf(config,"//Стандартно 0^n")
	fprintf(config,"aim_always_on 0^n")
	fprintf(config,"^n")
	fprintf(config,"//Attack function switch for aim_autoshoot:^n")
	fprintf(config,"//Способ выстрела.^n")
	fprintf(config,"// 0:^"+attack;wait;-attack^"^n")
	fprintf(config,"// 1: ^"ExecuteHam( Ham_Weapon_PrimaryAttack , iWeaponEnt[id]);^".^n")
	fprintf(config,"//Please pay attention. Without frame_delay user will fire wery fast with ExecuteHam function.^n")
	fprintf(config,"//Default:0^n")
	fprintf(config,"//Обратите внимание, чем меньше frame_delay тем быстрее будет стрелять пользователь через ExecuteHam^n")
	fprintf(config,"//Cтандартно 0^n")
	fprintf(config,"aim_attackmode 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//Frame delay for ^"attackmode 1^"^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"aim_frame_delay 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//AutoAim_always_on switch:^n")
	fprintf(config,"//1:When is user connected he'll get autoaim ability automatically.It may crash your server.^n")
	fprintf(config,"//0:Admin should give autoaim ability to user.^n")
	fprintf(config,"//Please pay attention:it's only autoaim. It will not make player to shoot.^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"aim_autoaim_always_on 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//Autoshoot_always_on switch:^n")
	fprintf(config,"//1:When is user connected he'll get autoshoot ability automatically.It may crash your server.^n")
	fprintf(config,"//0:Admin should give autoshoot ability to user.^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"aim_autoshoot_always_on 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//Button mode switch:^n")
	fprintf(config,"//0:AutoAim and AutoShoot is always on for players.^n")
	fprintf(config,"//1:Player should use +aimbot to make it work.^n")
	fprintf(config,"//Default 1.^n")
	fprintf(config,"aim_button_mode 1^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//Show_admin switch:^n")
	fprintf(config,"//0:Show none^n")
	fprintf(config,"//1:Show anonymously^n")
	fprintf(config,"//2:Show named^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"aim_show_admin 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//No Damage switch^n")
	fprintf(config,"//0:Player can kill someone using this cheat^n")
	fprintf(config,"//1:Player can't kill someon using this cheat^n")
	fprintf(config,"//Default 0^n")
	fprintf(config,"aim_no_damage 0^n")
	fprintf(config,"^n")
	fprintf(config,"^n")
	fprintf(config,"//Endless Ammo Swith:^n")
	fprintf(config,"//1:When fireing with cheat player will have endless ammo^n")
	fprintf(config,"//0:When fireing with cheat player will not have endless ammo^n")
	fprintf(config,"//1:При стрельбе читом у игрока будут бесконечные патроны^n")
	fprintf(config,"//0:Бесконечных патронов у игрока не будет^n")
	fprintf(config,"aim_endless_ammo 0^n")
	fprintf(config,"^n")
	fprintf(config,"aim_correction 0^n")
	fprintf(config,"aim_shoot_divide 1^n")
	fprintf(config,"^n")
	fclose(config)
	server_print("ServerAimBot.cfg created")
	return PLUGIN_HANDLED
}

public Create_Lang()
{
	new lang_file=fopen(p_Lang_File,"wt")
	fprintf(lang_file,"[en]^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF = You turned off aimbot for %%s^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL = You turned off aimbot for all players^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL_CT = You turned off aimbot for all CT^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL_T = You turned off aimbot for all T^n")
	fprintf(lang_file,"ADM_AIMBOT_ON = You turned on aimbot for %%s^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL = You turned on aimbot for all players^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL_CT = You turned on aimbot for all CT^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL_T = You turned on aimbot for all T^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF = You turned off AutoAim for %%s^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL = You turned off AutoAim for all players^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL_CT = You turned off AutoAim for all CT^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL_T = You turned off AutoAim for all T^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON = You turned on AutoAim for %%s^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL = You turned on AutoAim for all players^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL_CT = You turned on AutoAim for all CT^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL_T = You turned on AutoAim for all T^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF = You turned off AutoShoot for %%s^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL = You turned off AutoShoot for all players^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL_CT = You turned off AutoShoot for all CT^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL_T = You turned off AutoShoot for all T^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON = You turned on AutoShoot for %%s^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL = You turned on AutoShoot for all players^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL_CT = You turned on AutoShoot for all CT^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL_T = You turned on AutoShoot for all T^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_ALREADY_TURNED_OFF = Debug mode already turned off^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_ALREADY_TURNED_ON = Debug mode already turned on^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_TURNED_OFF = You turn off debug mode^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_TURNED_ON = You turn on debug mode^n")
	fprintf(lang_file,"ADM_PLAYER_WITH_AUTOAIM = %%s using AutoAim^n")
	fprintf(lang_file,"ADM_PLAYER_WITH_AUTOSHOOT = %%s using AutoShoot^n")
	fprintf(lang_file,"ADM_SERVERAIM_TURNED_OFF = You turned off ServerAim^n")
	fprintf(lang_file,"ADM_SERVERAIM_TURNED_ON = You turned on ServerAim^n")
	fprintf(lang_file,"AIMBOT_OFF = ADMIN turned off AimBot for %%s^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL = ADMIN turned off AimBot for all players^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_BY = ADMIN %%s turned off AimBot for all players^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_CT = ADMIN turned off AimBot for all CT^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_CT_BY = ADMIN %%s turned off AimBot for all CT^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_T = ADMIN turned off AimBot for all T^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_T_BY = ADMIN %%s turned off AimBot for all T^n")
	fprintf(lang_file,"AIMBOT_OFF_BY = ADMIN %%s turned off AimBot for %%s^n")
	fprintf(lang_file,"AIMBOT_ON = ADMIN turned on AimBot for %%s^n")
	fprintf(lang_file,"AIMBOT_ON_ALL = ADMIN turned on AimBot for all players^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_BY = ADMIN %%s turned on AimBot for all players^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_CT = ADMIN turned on AimBot for all CT^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_CT_BY = ADMIN %%s turned on AimBot for all CT^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_T = ADMIN turned on AimBot for all T^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_T_BY = ADMIN %%s turned on AimBot for all T^n")
	fprintf(lang_file,"AIMBOT_ON_BY = ADMIN %%s turned on AimBot for %%s^n")
	fprintf(lang_file,"AUTOAIM_OFF = ADMIN turned off AutoAim for %%s^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL = ADMIN turned off AutoAim for all players^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_BY = ADMIN %%s turned off AutoAim for all players^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_CT = ADMIN turned off AutoAim for all CT^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_CT_BY = ADMIN %%s turned off AutoAim for all CT^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_T = ADMIN turned off AutoAim for all T^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_T_BY = ADMIN %%s turned off AutoAim for all T^n")
	fprintf(lang_file,"AUTOAIM_OFF_BY = ADMIN %%s turned off AutoAim for %%s^n")
	fprintf(lang_file,"AUTOAIM_ON = ADMIN turned on AutoAim for %%s^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL = ADMIN turned on AutoAim for all players^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_BY = ADMIN %%s turned on AutoAim for all players^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_CT = ADMIN turned on AutoAim for all CT^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_CT_BY = ADMIN %%s turned on AutoAim for all CT^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_T = ADMIN turned on AutoAim for all T^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_T_BY = ADMIN %%s turned on AutoAim for all T^n")
	fprintf(lang_file,"AUTOAIM_ON_BY = ADMIN %%s turned on AutoAim for %%s^n")
	fprintf(lang_file,"AUTOSHOOT_OFF = ADMIN turned off AutoShoot for %%s^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL = ADMIN turned off AutoShoot for all players^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_BY = ADMIN %%s turned off AutoShoot for all players^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_CT = ADMIN turned off AutoShoot for all CT^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_CT_BY = ADMIN %%s turned off AutoShoot for all CT^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_T = ADMIN turned off AutoShoot for all T^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_T_BY = ADMIN %%s turned off AutoShoot for all T^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_BY = ADMIN %%s turned off AutoShoot for %%s^n")
	fprintf(lang_file,"AUTOSHOOT_ON = ADMIN turned on AutoShoot for %%s^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL = ADMIN turned on AutoShoot for all players^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_BY = ADMIN %%s turned on AutoShoot for all players^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_CT = ADMIN turned on AutoShoot for all CT^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_CT_BY = ADMIN %%s turned on AutoShoot for all CT^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_T = ADMIN turned on AutoShoot for all T^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_T_BY = ADMIN %%s turned on AutoShoot for all T^n")
	fprintf(lang_file,"AUTOSHOOT_ON_BY = ADMIN %%s turned on AutoShoot for %%s^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_OFF = ADMIN turned off ServerAim debug mode^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_OFF_BY = ADMIN %%s turned off ServerAim debug mode^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_ON = ADMIN turned on ServerAim debug mode^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_ON_BY = ADMIN %%s turned on ServerAim debug mode^n")
	fprintf(lang_file,"SERVERAIM_ALREADY_TURNED_OFF = ServerAim already turned off^n")
	fprintf(lang_file,"SERVERAIM_ALREADY_TURNED_ON = ServerAim already turned on^n")
	fprintf(lang_file,"SERVERAIM_TURNED_OFF = ADMIN turned off ServerAim^n")
	fprintf(lang_file,"SERVERAIM_TURNED_OFF_BY = ADMIN %%s turned off ServerAim^n")
	fprintf(lang_file,"SERVERAIM_TURNED_ON = ADMIN turned on ServerAim^n")
	fprintf(lang_file,"SERVERAIM_TURNED_ON_BY = ADMIN %%s turned on ServerAim^n")
	fprintf(lang_file,"^n")
	fprintf(lang_file,"[ru]^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF = Вы выключили аимбот у %%s^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL = Вы выключили аимбот у всех игроков^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL_CT = Вы выключили аимбот у всех контров^n")
	fprintf(lang_file,"ADM_AIMBOT_OFF_ALL_T = Вы выключили аимбот у всех терроров^n")
	fprintf(lang_file,"ADM_AIMBOT_ON = Вы включили аимбот у %%s^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL = Вы включили аимбот у всех игроков^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL_CT = Вы включили аимбот у всех контров^n")
	fprintf(lang_file,"ADM_AIMBOT_ON_ALL_T = Вы включили аимбот у всех терроров^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF = Вы выключили автонаведение у %%s^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL = Вы выключили автонаведение у всех игроков^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL_CT = Вы выключили автонаведение у всех контров^n")
	fprintf(lang_file,"ADM_AUTOAIM_OFF_ALL_T = Вы выключили автонаведение у всех терроров^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON = Вы включили автонаведение у %%s^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL = Вы включили автонаведение у всех игроков^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL_CT = Вы включили автонаведение у всех контров^n")
	fprintf(lang_file,"ADM_AUTOAIM_ON_ALL_T = Вы включили автонаведение у всех терроров^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF = Вы выключили автоматический выстрел у %%s^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL = Вы выключили автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL_CT = Вы выключили автоматический выстрел у всех контров^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_OFF_ALL_T = Вы выключили автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON = Вы включили автоматический выстрел у %%s^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL = Вы включили автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL_CT = Вы включили автоматический выстрел у всех контров^n")
	fprintf(lang_file,"ADM_AUTOSHOOT_ON_ALL_T = Вы включили автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_ALREADY_TURNED_OFF = Режим отладки аимбота уже выключил^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_ALREADY_TURNED_ON = Режим отладки аимбота уже включил^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_TURNED_OFF = Вы выключили режим отладки серверного аимбота^n")
	fprintf(lang_file,"ADM_DEBUG_MODE_TURNED_ON = Вы включили режим отладки серверного аимбота^n")
	fprintf(lang_file,"ADM_PLAYER_WITH_AUTOAIM = %%s использует автонаведение^n")
	fprintf(lang_file,"ADM_PLAYER_WITH_AUTOSHOOT = %%s использует автоматический выстрел^n")
	fprintf(lang_file,"ADM_SERVERAIM_TURNED_OFF = Вы выключили серверный аимбот^n")
	fprintf(lang_file,"ADM_SERVERAIM_TURNED_ON = Вы включили серверный аимбот^n")
	fprintf(lang_file,"AIMBOT_OFF = АДМИН выключил аимбот у %%s^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL = АДМИН выключил аимбот у всех игроков^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_BY = АДМИН %%s выключил аимбот у всех игроков^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_CT = АДМИН выключил аимбот у всех контров^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_CT_BY = АДМИН %%s выключил аимбот у всех контров^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_T = АДМИН выключил аимбот у всех терроров^n")
	fprintf(lang_file,"AIMBOT_OFF_ALL_T_BY = АДМИН %%s выключил аимбот у всех терроров^n")
	fprintf(lang_file,"AIMBOT_OFF_BY = АДМИН %%s выключил аимбот у %%s^n")
	fprintf(lang_file,"AIMBOT_ON = АДМИН включил аимбот у %%s^n")
	fprintf(lang_file,"AIMBOT_ON_ALL = АДМИН включил аимбот у всех игроков^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_BY = АДМИН %%s включил аимбот у всех игроков^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_CT = АДМИН включил аимбот у всех контров^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_CT_BY = АДМИН %%s включил аимбот у всех контров^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_T = АДМИН включил аимбот у всех терроров^n")
	fprintf(lang_file,"AIMBOT_ON_ALL_T_BY = АДМИН %%s включил аимбот у всех терроров^n")
	fprintf(lang_file,"AIMBOT_ON_BY = АДМИН %%s включил аимбот у %%s^n")
	fprintf(lang_file,"AUTOAIM_OFF = АДМИН выключил автонаведение у %%s^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL = АДМИН выключил автонаведение у всех игроков^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_BY = АДМИН %%s выключил автонаведение у всех игроков^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_CT = АДМИН выключил автонаведение у всех контров^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_CT_BY = АДМИН %%s выключил автонаведение у всех контров^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_T = АДМИН выключил автонаведение у всех терроров^n")
	fprintf(lang_file,"AUTOAIM_OFF_ALL_T_BY = АДМИН %%s выключил автонаведение у всех терроров^n")
	fprintf(lang_file,"AUTOAIM_OFF_BY = АДМИН %%s выключил автонаведение у %%s^n")
	fprintf(lang_file,"AUTOAIM_ON = АДМИН включил автонаведение у %%s^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL = АДМИН включил автонаведение у всех игроков^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_BY = АДМИН %%s включил автонаведение у всех игроков^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_CT = АДМИН включил автонаведение у всех контров^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_CT_BY = АДМИН %%s включил автонаведение у всех контров^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_T = АДМИН включил автонаведение у всех терроров^n")
	fprintf(lang_file,"AUTOAIM_ON_ALL_T_BY = АДМИН %%s включил автонаведение у всех терроров^n")
	fprintf(lang_file,"AUTOAIM_ON_BY = АДМИН %%s включил автонаведение у %%s^n")
	fprintf(lang_file,"AUTOSHOOT_OFF = АДМИН выключил автоматический выстрел у %%s^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL = АДМИН выключил автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_BY = АДМИН %%s выключил автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_CT = АДМИН выключил автоматический выстрел у всех контров^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_CT_BY = АДМИН %%s выключил автоматический выстрел у всех контров^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_T = АДМИН выключил автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_ALL_T_BY = АДМИН %%s выключил автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"AUTOSHOOT_OFF_BY = АДМИН %%s выключил автоматический выстрел у %%s^n")
	fprintf(lang_file,"AUTOSHOOT_ON = АДМИН включил автоматический выстрел у %%s^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL = АДМИН включил автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_BY = АДМИН %%s включил автоматический выстрел у всех игроков^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_CT = АДМИН включил автоматический выстрел у всех контров^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_CT_BY = АДМИН %%s включил автоматический выстрел у всех контров^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_T = АДМИН включил автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"AUTOSHOOT_ON_ALL_T_BY = АДМИН %%s включил автоматический выстрел у всех терроров^n")
	fprintf(lang_file,"AUTOSHOOT_ON_BY = АДМИН %%s включил автоматический выстрел у %%s^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_OFF = АДМИН выключил режим отладки серверного аимбота^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_OFF_BY = АДМИН %%s выключил режим отладки серверного аимбота^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_ON = АДМИН включил серверный аимбот debug mode^n")
	fprintf(lang_file,"DEBUG_MODE_TURNED_ON_BY = АДМИН %%s включил серверный аимбот debug mode^n")
	fprintf(lang_file,"SERVERAIM_ALREADY_TURNED_OFF = серверный аимбот уже выключил^n")
	fprintf(lang_file,"SERVERAIM_ALREADY_TURNED_ON = серверный аимбот уже включил^n")
	fprintf(lang_file,"SERVERAIM_TURNED_OFF = АДМИН выключил серверный аимбот^n")
	fprintf(lang_file,"SERVERAIM_TURNED_OFF_BY = АДМИН %%s выключил серверный аимбот^n")
	fprintf(lang_file,"SERVERAIM_TURNED_ON = АДМИН включил серверный аимбот^n")
	fprintf(lang_file,"SERVERAIM_TURNED_ON_BY = АДМИН %%s включил серверный аимбот^n")
	fclose(lang_file)
	server_print("ServerAimBot.txt created")
	return PLUGIN_HANDLED
}
//______________v 0.0.2.RC_______________________//
public  find_nearest(id)
{
	new Float:min_angle_xy=float(720)
	new Float:angle_xy
	new Float:aim_vector[3]
	entity_get_vector(id, EV_VEC_v_angle, aim_vector)
	if(floatcmp(aim_vector[1],float(180))==1)
		aim_vector[1]=floatadd(float(-360),aim_vector[1])
	if(floatcmp(aim_vector[1],float(-180))==-1)
		aim_vector[1]=floatadd(float(360),aim_vector[1])
	if(Aim_Debug>5)
	{
		fprintf(Debug_File,"___________Looking for nearest target for %s_____________^n",name[id])
		fprintf(Debug_File,"%s aim vector={%f,%f,%f}^n",name[id],aim_vector[0],aim_vector[1],aim_vector[2])
			
	}
	new nearest_target
	for(new counter=0;counter<Targets_Can_Be_Shooted_Counter[id];counter++)//проверка в плоскости xy
	{	
		if(floatcmp(target_vector[id][Targets_Can_Be_Shooted[id][counter]][1],float(180))==1)
			target_vector[id][Targets_Can_Be_Shooted[id][counter]][1]=floatadd(float(-360),target_vector[id][Targets_Can_Be_Shooted[id][counter]][1])
		if(floatcmp(target_vector[id][Targets_Can_Be_Shooted[id][counter]][1],float(-180))==-1)
			target_vector[id][Targets_Can_Be_Shooted[id][counter]][1]=floatadd(float(360),target_vector[id][Targets_Can_Be_Shooted[id][counter]][1])
		angle_xy=floatabs(floatsub(aim_vector[1],target_vector[id][Targets_Can_Be_Shooted[id][counter]][1]))
		if(Aim_Debug>5)
		{
			fprintf(Debug_File,"angle_xy:<%s>:<%s>=%f^n",name[id],name[Targets_Can_Be_Shooted[id][counter]],angle_xy)
			fprintf(Debug_File,"Target vector from %s to %s={%f,%f,%f}^n",name[id],name[Targets_Can_Be_Shooted[id][counter]],target_vector[id][Targets_Can_Be_Shooted[id][counter]][0],target_vector[id][Targets_Can_Be_Shooted[id][counter]][1],target_vector[id][Targets_Can_Be_Shooted[id][counter]][2])
		}
		if(floatcmp(angle_xy,min_angle_xy)<0)
		{
			min_angle_xy=angle_xy
			nearest_target=Targets_Can_Be_Shooted[id][counter]
			if(Aim_Debug>5)
			{
				fprintf(Debug_File,"Min angle_xy:<%s>:<%s>=%f^n",name[id],name[Targets_Can_Be_Shooted[id][counter]],angle_xy)
			
			}
		}
	
	}
	if(Aim_Debug>5)
	{
		fprintf(Debug_File,"___________Nearest_Tatget_IS_%i_<%s>_____________^n^n^n",nearest_target,name[nearest_target])
			
	}
	return nearest_target
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
